<template>
  <div class="einfo-w">
    <Title text="物流车辆信息统计" />
    <div class="ctxtt">
      <ul>
        <li class="itm" v-for="(item, index) in list" :key="index">
          <div class="tp">
            <div class="name">{{item.label}}</div>
            <div class="quantity">{{item.quantity}} <span>  家</span></div>
          </div>
          <div class="line">
            <div class="pre" :style="{width: `${item.beginRate}%`}"></div>
            <div class="in" :style="{width: `${item.rate}%`}"></div>
            <!-- <div class="circle">
              <div class="cr2"></div>
            </div> -->
          </div>
        </li>
      </ul>
    </div>
  </div>
</template>

<script>
import Title from './title.vue'
import { getCompanyLogisticsInfo } from '@/api/express'

export default {
  components: {
    Title
  },
  data() {
    return {
      list: []
    }
  },
  mounted() {
    getCompanyLogisticsInfo().then(res => {
      if (res?.success) {
        const { economicType = [] } = res.result
        let total = 0
        economicType.forEach(item => {
          total += item.ycoordinate
        })
        const list = []
        economicType.forEach((item, index) => {
          const rate = (item.ycoordinate / (total * 1.0)).toFixed(2) * 100
          list.push({
            label: item.xcoordinate,
            quantity: item.ycoordinate,
            beginRate: index === 0 ? 0 : list[index - 1].endRate,
            endRate: index === 0 ? rate : list[index - 1].endRate + rate,
            rate
          })
        })
        this.list = list
      }
    })
  }
}
</script>

<style lang="less">
.einfo-w {
  height: 1904px;
  .ctxtt {
    height: 1772px;
    padding-right: 12px;
    margin-bottom: 265px;
    overflow-y: auto;
    margin-top: 108px;

    li.itm {
      // width: 1404px;
      height: 132px;
      .tp {
        display: flex;
        align-items: center;
        justify-content: space-between;
        margin-bottom: 24px;
      }
      .name {
        font-size: 40px;
        font-weight: 350;
        line-height: 49px;
        color: #A3A5A6;
      }
      .quantity {
        font-size: 60px;
        line-height: 48px;
        font-weight: 700;
        color: #E6F7FF;
        span {
          font-size: 40px;
          line-height: 49px;
          font-weight: normal;
          color: #A3A5A6;
        }
      }
      .line {
        position: relative;
        display: flex;
        flex-direction: row;
        align-items: center;
        justify-content: flex-start;
        height: 16px;
        background-color: rgba(112, 112, 112, 0.6);
        .pre, .in {
          height: 16px;
        }
        .in {
          background: linear-gradient(270deg, #1B7EF2 0%, rgba(112,112,112,0.23) 99%);
        }
        .circle {
          width: 48px;
          height: 48px;
          text-align: center;
          border-radius: 50%;
          background: rgba(22, 22, 22, 0);
          border: 3px solid rgba(65, 222, 255, 0.48);
          filter: blur(2px);
          // position: absolute;
          .cr2 {
            display: inline-block;
            width: 20px;
            height: 20px;
            margin-top: 12px;
            border-radius: 50%;
            background: radial-gradient(50% 50% at 50% 50%, #ECFDFF 9%, #41DEFF 100%);
            box-shadow: 0px 0px 15.78px 12px rgba(0, 174, 255, 0.44);
          }
        }
      }
    }
  }
}
</style>
